<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{a}}
        {{b}}
    </div>
    <script src="../vue.js"></script>
    <script>
        let vm=new Vue({
            el:'#app',
            data () {
                return {
                    a:1,
                }
            },
            computed: {
                b:{
                    get(){
                        console.log('获取');
                        return this.a+1;
                    },
                    set(val){
                        console.log(val);

                    }
                }
            }
        })

        let obj={
            a:1,
            b:2,
        }
        obj.c=3;
        console.log(obj);
        let d1=4;
        Object.defineProperty(obj,'d',{
            configurable: true,
            get(){
                console.log('get');
                return d1;
            },
            set(val){
                console.log(val);
                console.log('set');
            }
        })
        // delete obj.d;
    </script>
</body>
</html>